<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserExamRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_exam_records', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('users_id')->comment("用户id");
            $table->string('username')->comment("用户名");
            $table->unsignedInteger('exam_paper_id')->comment("试卷id");
            $table->tinyInteger("is_submitted")->default(0)->comment("是否提交[未提交|已提交]");
            $table->string('exam_paper_name')->comment("试卷名称");
            $table->unsignedInteger('certificate_id')->comment("证书id");
            $table->unsignedInteger('certificate_name')->comment("证书名称");
            $table->unsignedInteger('score')->comment("分数");
            $table->unsignedInteger('take_time')->comment("用时");
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_exam_records');
    }
}
